﻿@model List<Yelp>
@using Yelper.Web

@{
    ViewBag.Title = "Welcome @" + Context.User.Identity.Name;
    var idols = (List<User>)ViewData["Idols"];
    var groupies = (List<User>)ViewData["Groupies"];
}

<h1>Welcome @@@Context.User.Identity.Name</h1>

@using (Ajax.BeginForm(
    new AjaxOptions() { 
        Url = Url.Action("Yelp","Ajax"), 
        HttpMethod = "Post", 
        LoadingElementId = "Posting", 
        UpdateTargetId = "NewYelps",
        InsertionMode = InsertionMode.InsertBefore,
        OnSuccess = "YelpSuccess"
    })) {

    <textarea name="Yelp" id="Yelp" ></textarea>
    <div id="YelpUserSuggestions">
       
    </div>
    <div id="YelpInputOptions" >
        <div id="CharactersLeft">141</div>
        <input type="submit" id="YelpSubmit" value="Yelp" />
        <div id="Posting"><img alt="loading" src="@Url.Content("~/Content/Images/loading.gif")" /></div>
    </div>
    
    <div id="NewYelps"></div>
    
}

@foreach (var yelp in ViewData.Model) {

    @Html.Partial("YelpPartial", yelp)
    
}

@section right {	

<h1>Idols</h1>
@Html.Partial("UserIconsPartial", idols)

<br /><br /><br />

<h1>Groupies</h1>
@Html.Partial("UserIconsPartial", groupies)

}